# 字符串 String
s1 = "Hello, world!"
s2 = 'Python is awesome.'
s3 = """This is a multi-line string.
It can be used for writing comments or documentation."""
print(s1)
print(s2)
print(s3)

print("===" * 20)

# 字符串的基本操作

# 字符串更新
s1 = "Hello, world!"
s1 = s1[:7] + "Python"
print(s1)

import time

for i in range(101): # 添加进度条图形和百分比
    bar = '[' + '=' * (i // 2) + ' ' * (50 - i // 2) + ']'
    print(f"\r{bar} {i:3}%", end='', flush=True)
    time.sleep(0.05)
print() # 换行

# 字符串格式化
s1 = "Hello, {}!".format("world")
s2 = "The value of pi is approximately {:.2f}."
print(s1)
print(s2.format(3.1415926))
print("我叫 %s 今年 %d 岁。" % ("小明", 20))

name = "小明"
print(f'Hello {name}')

x = 10
print(f'{x+1}')
print(f'{x+2=}')